//
//  UIButton+extension.m
//  weiboObjectC
//
//  Created by 隗杰 on 16/2/20.
//  Copyright © 2016年 kkk. All rights reserved.
//

#import "UIButton+extension.h"

@implementation UIButton (extension)

+ (instancetype)butnWithImageName:(NSString *)imageName andTitle:(NSString *)title andBackgrandImage:(NSString *)backgrandImage andFontSize:(CGFloat)fontSize andFontColor:(UIColor *)fontColor {
    
    UIButton *b = [[UIButton alloc] init];
    
    if (imageName) {
        [b setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    }
    if (title) {
        [b setTitle:title forState:UIControlStateNormal];
    }
    if (backgrandImage) {
        [b setBackgroundImage:[UIImage imageNamed:backgrandImage] forState:UIControlStateNormal];
    }
    if (fontColor) {
        [b setTitleColor:fontColor forState:UIControlStateNormal];
    }
    if (fontSize) {
        b.titleLabel.font = [UIFont systemFontOfSize:fontSize];
    }
    [b sizeToFit];
    return b;
}

@end
